<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../../component/pear/css/pear.css" />
</head>
<body>
<div id="descriptions"></div>
<script src="../../component/layui/layui.js"></script>
<script src="../../component/pear/pear.js"></script>
<script>
    layui.use(['descriptions', 'dict', 'jquery'], function() {
        let desc = layui.descriptions;
        let $ = layui.jquery;
        let url = layui.url();
        let id = url.search.id;
        let dict = layui.dict;

        desc.render({
            elem: '#descriptions',
            fieldNum: 2,
            url: '/vtl-log-operation/detail/' + id,
            cols: [
                { field: 'id', title: 'ID', hide: true },
                { field: 'url', title: '请求链接' },
                { field: 'httpMethod', title: '请求方式' },
                { field: 'requestArgs', title: '请求参数', longtext: true, templet: function(d){
                    let $textarea = $('<textarea/>', { class: 'layui-textarea' }).attr('readonly', true).text($.vtl.blankToDefault(d.requestArgs, ''));
                    return $textarea.get(0).outerHTML;
                }},
                { field: 'requestBody', title: '请求体', longtext: true, templet: function(d){
                    let $textarea = $('<textarea/>', { class: 'layui-textarea' }).attr('readonly', true).text($.vtl.blankToDefault(d.requestBody, ''));
                    return $textarea.get(0).outerHTML;
                }},
                { field: 'methodName', title: '方法名称', longtext: true },
                { field: 'browser', title: '浏览器', newline: true },
                { field: 'platform', title: '设备平台类型' },
                { field: 'operatingSystem', title: '操作系统' },
                { field: 'ip', title: 'IP', newline: true },
                { field: 'ipLocation', title: 'IP 位置' },
                { field: 'succeeded', title: '请求状态', templet: function(d){
                    return dict.label('vtl_succeeded', d.succeeded, true);
                }},
                { field: 'createByName', title: '创建者', newline: true },
                { field: 'createTime', title: '创建时间', templet: function (d) {
                    return layui.util.toDateString(d.createTime, "yyyy-MM-dd HH:mm:ss");
                }},
                { field: 'updateByName', title: '更新者' },
                { field: 'updateTime', title: '更新时间', templet: function (d) {
                    return layui.util.toDateString(d.updateTime, "yyyy-MM-dd HH:mm:ss");
                }},
                { field: 'errorInfo', title: '异常信息', longtext: true },
            ]
        });
    })
</script>
</body>
</html>
